package panel;

import javax.swing.Icon;
import javax.swing.table.DefaultTableModel;

/**
 * A very basic table model consisting of three columns:
 * 1) File Type
 * 2) File Name
 * 3) Tags
 * @author Shahriar Haque
 *
 */
public class TableModel extends DefaultTableModel {


	private static final long serialVersionUID = 1L;

	private String[] columnNames = {"Type", "Name", "Tags"};

	private Class<?>[] columnClasses = {Icon.class, String.class, String.class};
	
	
	public TableModel(Object[][] data){
		
		this.setDataVector(data, columnNames);
	}
	

	public int getColumnCount() {
		return columnNames.length;
	}
	
    public String getColumnName(int c) {
        return columnNames[c];
    }
	
	// helps determine the correct renderer for the data type
    public Class<?> getColumnClass(int c) {
        return columnClasses[c];
    }
    

    public boolean isCellEditable(int row, int col) {
    	if(col < 1) return false;
    	return true;
    }

}
